home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.3 KB | 45 lines | [TEXT/GEOL] |
- Item 2909944 25-July-88 03:59
-
- From: SCHMUCKER1 Schmucker, Kurt
-
- To: D1220 VarLite, Dev, Andy Meldrum
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Re: Difference Between
-
- Andy,
-
- The example you raised (object initialization) is one of the few where the
- difference between creating a new method and overridding an existing method is
- often clear. The reason has to do with parameters. In Object Pascal and in
- C++, the parameter list of an overridden method must be EXACTLY the same as the
- inherited method. So, if in your MyObject class, you need some additional
- parameters to intialize the object (a very common case), then you would have to
- declare a new intialization method. If this method were named in accordance
- with the Apple guidelines, then the code would look something like this:
-
- TYPE
- TMyObject = OBJECT(TObject)
- fThing: SomeType;
- PROCEDURE TMyObject.IMyObject(aThing: SomeType);
- END;
-
- PROCEDURE TMyObject.IMyObject(aThing: SomeType);
- BEGIN
- SELF.IObject;
- SELF.fThing := aThing;
- END;
-
-
-
-
- If you didn't need to add a parameter, then you wouldn't HAVE to define
- a new initialization method.
-
-
-
- Kurt
-
-
-